package com.learn.my;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test0003 {

    public static void main(String[] args){
        //可缓存的线程池重复利用，无限大小
        ExecutorService newCachedThreadPool= Executors.newCachedThreadPool();

        for (int i = 0; i < 10; i++) {
            final  int temp=i;
            newCachedThreadPool.execute(new Runnable() {
                public void run() {
                    System.out.println(Thread.currentThread().getName()+","+temp);
                }
            });
        }
    }
}
